package org.example;

public class UserAssembler {
    private final AgeService ageService;
    private final SexService sexService;

    public UserAssembler(AgeService ageService, SexService sexService) {
        this.ageService = ageService;
        this.sexService = sexService;
    }

    User buildUser(String name) {
        int age = ageService.getAge(name);
        String sex = sexService.getSex(name);
        int bmi = getBmi(name, sex);
        return new User(name, sex, age, bmi);
    }

    private int getBmi(String name, String sex) {
        return name.length() + sex.length();
    }
}